Skip to content

Auto-populate required slices in profile createResource()#91

Merged
ryukzak merged 3 commits intomainfrom
feat/auto-populate-required-slices
Mar 4, 2026
Merged

Auto-populate required slices in profile createResource()#91
ryukzak merged 3 commits intomainfrom
feat/auto-populate-required-slices

Conversation

@ryukzak
Copy link
Copy Markdown
Collaborator

@ryukzak ryukzak commented Mar 4, 2026

Summary

  • Array fields with required slices (min >= 1) are now auto-populated with discriminator match values in createResource()/create()
  • Users no longer need to pass empty arrays and manually call slice setters for required slices
  • Example: category on bodyweight/BP profiles is auto-set with VSCat discriminator; component on BP is auto-set with systolic/diastolic stubs
// Before: category was a required param, user had to setVscat() separately
const bp = bpProfile.create({ status: "final", category: [], subject: {...} });
bp.setVscat();

// After: category auto-populated, removed from params
const bp = bpProfile.create({ status: "final", subject: {...} });

Test plan

  • Updated bodyweight tests — removed category: [] from create calls, verified auto-population
  • Updated BP tests — removed category: [], verified component auto-populated with systolic/diastolic stubs
  • Updated snapshots
  • Regenerated R4 profile examples
  • bun run typecheck && bun run lint && bun test
  • make all

🤖 Generated with Claude Code

ryukzak added 3 commits March 4, 2026 13:57
Array fields with required slices (min >= 1) are now auto-populated
with their discriminator match values in the generated factory methods.
This removes them from required params so users don't need to pass
empty arrays and manually call slice setters.
Remove category:[] from create() calls in bodyweight and BP tests.
Update validation expectations and slice accessor tests to reflect
auto-populated discriminator values. Update snapshots.
@ryukzak ryukzak merged commit 9b24513 into main Mar 4, 2026
29 checks passed
@ryukzak ryukzak deleted the feat/auto-populate-required-slices branch March 4, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant